﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jenvin.Library.DataStruct.Algorithm
{
    public class Match
    {
        public static Match Empty = new Match() { Index = -1, Keyword = "" };
        public int Index { get; set; }
        public string Keyword { get; set; }

        public override int GetHashCode()
        {
            int result = 0;
            result = (result ^ 397) ^ (Keyword == null ? 0 : Keyword.GetHashCode());
            result = (result ^ 397) ^ (Index.GetHashCode());
            return result;
            //return base.GetHashCode();
        }
        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            if (this == obj) return true;
            if (this.GetType() != obj.GetType())
                return false;
            Match other = (Match)obj;
            return this.Keyword == other.Keyword
                && this.Index == other.Index;
        }
    }
}
